﻿Public Class frmBanco

    Dim ds As DataSet = Nothing

    Sub New(dt As DataSet)

        ' Llamada necesaria para el diseñador.
        InitializeComponent()

        ' Agregue cualquier inicialización después de la llamada a InitializeComponent().
        Me.ds = dt
    End Sub

    Private Sub frmBanco_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
        If (e.KeyCode = Keys.Escape) Then
            Me.Close()
        End If
    End Sub

    Private Sub frmBanco_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        cargarBancos()
    End Sub

    Sub cargarBancos()
        dgvBancos.DataSource = ds.Tables(0)

        If ds.Tables(0).Rows.Count <> 0 Then
            dgvBancos.Rows(0).Selected = False
        End If
    End Sub

    Private Sub dgvBancos_CellClick(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvBancos.CellClick
        Dim f As Integer = e.RowIndex

        If f > -1 Then
            frmMenu.formDocumento.txtBanco.Text = dgvBancos.Item("Column1", f).Value.ToString.Trim
            'frmDocumento.lblBanco.Text = dgvBancos.Item("Column2", f).Value.ToString.Trim
            DialogResult = Windows.Forms.DialogResult.OK
        End If
    End Sub
End Class